package com.bluestarenergy.party.sample.domain;

import java.util.ArrayList;
import java.util.List;


public class Country extends PartyRole {

	private static final long serialVersionUID = 1L;
	private List<PartyRelationship> deps;
	
	public String getCountryName() {
		String hubName = "";
		Organization org = (Organization) getParty();
		if (org != null ){
			OrganizationDetail detail = org.getOrganizationDetail();
			if (detail != null &&
					detail.getOrganizationName() != null &&
					! "".equalsIgnoreCase(detail.getOrganizationName().trim())) {
				hubName = org.getOrganizationDetail().getOrganizationName();
			}
		}
		return hubName;
	}

	public String getShortName() {
		String shortName = "";
		Organization org = (Organization) getParty();
		if (org != null ){
			OrganizationDetail detail = org.getOrganizationDetail();
			if (detail != null &&
					org.getOrganizationDetail().getAlias() != null &&
					! "".equalsIgnoreCase(org.getOrganizationDetail().getAlias().trim())) {
				shortName = org.getOrganizationDetail().getAlias();
			}
		}
		return shortName;
	}
	
	public List<Department> getDepartments() {
		List<Department> deps = new ArrayList<Department>();
		for (PartyRelationship ship: getDeps()) {
			deps.add((Department)ship.getFromRole());
		}
		return deps;
	}
	
	public List<PartyRelationship> getDeps() {
		return deps;
	}

	public void setDeps(List<PartyRelationship> deps) {
		this.deps = deps;
	}	
}